﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xts
{
    namespace XInterBank
    {
        namespace TradingClient
        {
            public interface IXOrderNortifyerHandler
            {
                void OrderInfoNortify(XBondOrderInfo orderInfo);							//普通委托信息推送
                void OrderFillNortify(XBondOrderFill orderFill);							//普通委托成交推送
                void MarketMakingOrderInfoNortify(XBondMarketMakingOrderInfo orderInfo); 	//做市委托信息推送
                void MarketMakingOrderFillNortify(XBondOrderFill orderFill);				//做市委托成交推送
            }

            public class IXOrderNortifyerI : IXOrderNortifyerDisp_
            {
                protected IXOrderNortifyerHandler x_handler;
                protected Ice.Logger x_logger;

                protected IXOrderNortifyerI(ref IXOrderNortifyerHandler handler, ref Ice.Logger logger)
                {
                    x_handler = handler;
                    x_logger = logger;
                }
                public override void OrderInfoNortify(XBondOrderInfo orderInfo, Ice.Current current__)
                {
                    try
                    {
                        x_handler.OrderInfoNortify(orderInfo);
                    }
                    catch(Ice.Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                    catch(Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                    
                }

                public override void OrderFillNortify(XBondOrderFill orderFill, Ice.Current current__)
                {
                    try
                    {
                        x_handler.OrderFillNortify(orderFill);
                    }
                    catch (Ice.Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                    catch (Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                }

                public override void MarketMakingOrderInfoNortify(XBondMarketMakingOrderInfo orderInfo, Ice.Current current__)
                {
                    try
                    {
                        x_handler.MarketMakingOrderInfoNortify(orderInfo);
                    }
                    catch (Ice.Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                    catch (Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                }

                public override void MarketMakingOrderFillNortify(XBondOrderFill orderFill, Ice.Current current__)
                {
                    try
                    {
                        x_handler.MarketMakingOrderFillNortify(orderFill);
                    }
                    catch (Ice.Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                    catch (Exception ex)
                    {
                        x_logger.error(ex.Message);
                    }
                }
            }
        }
    }
    
}
